package org.simple.framework.data.jpa.entity;

import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import org.simple.framework.data.entity.Identifiable;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

/**
 * 项目名称：simple-framework
 * 类名称：NativeID
 * 类描述：据库Native方法管理主键的entity基类
 * 创建时间：2018/8/15
 * <p>
 * 对于 oracle 采用Sequence(Hibernate_Sequence)方式
 * 对于 MySQL 和 SQL Server 采用identity(自增主键)
 *
 * @author sisyphus   (E-mail:1620657419@qq.com)
 * @version v1.0
 */
@Data
@MappedSuperclass
public abstract class NativeIdEntity implements Identifiable<Long> {

    @Id
    @Column(name = "ID")
    @GeneratedValue(generator = "db-native")
    @GenericGenerator(name = "db-native", strategy = "native")
    protected Long id;

}
